package com.icbc.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ConfigBean {//@configuration-----spring applicationContext.xml
    //配置负载均衡实现RestTemplate
    //IRule Eureka自带的负载均衡策略
    //RandomRule 随机
    //RoundRobinRule 轮询
    //AvailabilityFilteringRule :先过滤掉宕机的服务，对剩下的服务进行轮询
    @Bean
    @LoadBalanced //Ribbon负载均衡
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
